<script setup>
const props = defineProps({
  title: String,
  value: [Number, String],
  description: String,
});
</script>

<template>
  <div class="statistic-card">
    <el-statistic :value="props.value">
      <template #title>
        <div style="display: inline-flex; align-items: center">
          {{ props.title }}
          <el-tooltip
            effect="dark"
            :content="props.description"
            placement="top"
          >
            <el-icon style="margin-left: 4px" :size="12">
              <Warning />
            </el-icon>
          </el-tooltip>
        </div>
      </template>
    </el-statistic>
  </div>
</template>

<style scoped lang="less">
.statistic-card {
  background-color: #fff; /* 背景色 */
  border-radius: 8px; /* 圆角 */
  border: 1px solid #dcdfe6; /* 边框 */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 -4px 8px rgba(0, 0, 0, 0.1);
  padding: 8px 12px; /* 内边距 */
  width: 100%; /* 自适应宽度 */
  max-width: 250px; /* 最大宽度 */
  margin: 10px 0; /* 上下间距 */
}

.el-statistic {
  margin-bottom: 10px;
}

.el-tooltip {
  margin-left: 4px;
}

.el-statistic__title {
  font-weight: bold;
  font-size: 16px;
  color: #333;
}

.el-statistic__content {
  font-size: 20px;
  font-weight: 600;
  color: #42b983; /* 自定义字体颜色 */
}

.statistic-card:hover {
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.15); /* 鼠标悬浮时增加阴影 */
  transform: translateY(-2px); /* 鼠标悬浮时上升 */
  transition: all 0.3s ease; /* 平滑过渡 */
}
</style>
